Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure that we pass markdown to parser when getting the parsed originalCommentHTML #13703

Merged
merged 1 commit into from
Dec 19, 2022

Conversation

yuwenmemon
Copy link
Contributor

@yuwenmemon yuwenmemon commented Dec 19, 2022

@stitesExpensify please review

Details

We were passing HTML to the parser.replace function here - this caused us to double escape the HTML when comparing it with the original, which meant that we would mistakenly think a non-edited comment was indeed changed.

Fixed Issues

$ #13661

Tests

  1. Send a message with 3 backpacks (e.g. ```hello world```)
  2. Press edit from context menu
  3. Press save changes without editing message
  4. Make sure the message stays in the chat

  1. Open any chat
  2. Write a message surrounded in quotes "example"
  3. Click/Tap the "Edit comment" button
  4. Edit the comment to something else (still in quotes) "example 2"
  5. Save the comment
  6. Click/Tap the "Edit comment" button again
  7. Save the comment without changing any text
  8. Make sure the comment doesn't disappear and the edited label doesn't flash
  9. Edit the message to whatever you want without quotes example
  10. Save the message and make sure it edits correctly
  • Verify that no errors appear in the JS console

Offline tests

Same as online tests above.

QA Steps

Same as tests above

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
Kapture.2022-12-19.at.12.28.51.mp4
Mobile Web - Chrome
Kapture.2022-12-19.at.12.49.20.mp4
Mobile Web - Safari
Kapture.2022-12-19.at.12.44.55.mp4
Desktop
Kapture.2022-12-19.at.12.33.38.mp4
iOS
Kapture.2022-12-19.at.12.43.34.mp4
Android
Kapture.2022-12-19.at.12.51.40.mp4

@yuwenmemon yuwenmemon self-assigned this Dec 19, 2022
@github-actions
Copy link
Contributor

⚠️ ⚠️ Heads up! This pull request has the CP Staging label ⚠️ ⚠️
If you applied the CP Staging label before the PR was merged, the PR will be be immediately deployed to staging even if the open StagingDeployCash deploy checklist is locked.
However if you applied the CP Staging after the PR was merged it's possible it won't be CP'ed automatically. If you need it to be CP'ed to staging, tag a member of @Expensify/mobile-deployers to CP it manually, otherwise you can wait for it to go out with the next deploy.

Copy link
Contributor

@stitesExpensify stitesExpensify left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, testing now

@yuwenmemon
Copy link
Contributor Author

Code LGTM, testing now

haha same

@yuwenmemon yuwenmemon marked this pull request as ready for review December 19, 2022 20:52
@yuwenmemon yuwenmemon requested a review from a team as a code owner December 19, 2022 20:52
@melvin-bot melvin-bot bot requested review from techievivek and thesahindia and removed request for a team December 19, 2022 20:52
@melvin-bot
Copy link

melvin-bot bot commented Dec 19, 2022

@thesahindia @techievivek One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@stitesExpensify
Copy link
Contributor

stitesExpensify commented Dec 19, 2022

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
2022-12-19_13-54-48.mp4
Mobile Web - Chrome
2022-12-19_14-04-33.mp4
Mobile Web - Safari
2022-12-19_14-02-43.mp4
Desktop
2022-12-19_13-56-32.mp4
iOS
2022-12-19_14-01-48.mp4
Android
2022-12-19_14-12-06.mp4

@stitesExpensify
Copy link
Contributor

Removing @thesahindia I don't think we need C+ review here

@stitesExpensify stitesExpensify removed the request for review from thesahindia December 19, 2022 21:04
Copy link
Contributor

@stitesExpensify stitesExpensify left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests well!

@stitesExpensify stitesExpensify merged commit 0d024be into main Dec 19, 2022
@stitesExpensify stitesExpensify deleted the yuwen-htmlToMarkdown branch December 19, 2022 21:14
OSBotify pushed a commit that referenced this pull request Dec 19, 2022
Make sure that we pass markdown to parser when getting the parsed originalCommentHTML

(cherry picked from commit 0d024be)
@github-actions
Copy link
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
TTI 812.562 ms → 843.664 ms (+31.102 ms, +3.8%)
runJsBundle 190.688 ms → 196.800 ms (+6.113 ms, +3.2%)
nativeLaunch 10.188 ms → 10.375 ms (+0.188 ms, +1.8%)
regularAppStart 0.016 ms → 0.015 ms (-0.001 ms, -4.3%)
Show details
Name Duration
TTI Baseline
Mean: 812.562 ms
Stdev: 34.035 ms (4.2%)
Runs: 757.6326939999126 762.9388569998555 768.4518229998648 770.7812379999086 778.0377460001037 780.1741369999945 780.471934999805 782.1775810001418 784.3629270000383 788.4900469998829 794.4313110001385 803.1564629999921 804.3424459998496 804.7647560001351 805.9882559999824 809.9961950001307 810.318566000089 810.6724669998512 819.9167149998248 819.9230320001952 821.8025549999438 823.4997459999286 830.0100279999897 837.0340769998729 848.2534940000623 851.5996630000882 852.0257489997894 855.824672000017 859.5467750001699 883.9150459999219 888.8752489998005

Current
Mean: 843.664 ms
Stdev: 47.735 ms (5.7%)
Runs: 765.2732409997843 778.379079000093 782.6285279998556 793.593334000092 796.1799880000763 797.2860329998657 804.5568690001965 808.088620999828 810.7221690001898 813.5211290000007 818.7559440000914 820.5310610001907 822.5237690000795 823.2403370002285 823.8995719999075 837.4542419998907 842.1123379999772 845.1559009999037 858.2127279997803 858.2488400000148 862.7218519998714 862.937634000089 867.579975000117 869.1861160001718 871.3055690000765 874.9323370000347 909.6320070000365 910.3848500000313 920.4330879999325 948.0949679999612 956.014295999892
runJsBundle Baseline
Mean: 190.688 ms
Stdev: 19.597 ms (10.3%)
Runs: 161 163 163 168 169 172 173 174 175 176 180 182 184 184 186 187 187 190 191 196 197 199 199 203 203 206 213 216 222 222 222 239

Current
Mean: 196.800 ms
Stdev: 16.987 ms (8.6%)
Runs: 171 173 173 177 177 180 182 183 186 187 189 190 191 192 194 195 197 197 198 198 202 208 210 211 218 220 225 225 227 228
nativeLaunch Baseline
Mean: 10.188 ms
Stdev: 1.740 ms (17.1%)
Runs: 8 8 8 8 8 8 8 8 9 9 9 9 9 10 10 10 10 10 11 11 11 11 11 12 12 12 12 12 13 13 13 13

Current
Mean: 10.375 ms
Stdev: 2.190 ms (21.1%)
Runs: 8 8 8 8 8 8 8 8 9 9 9 9 9 10 10 10 10 10 10 10 11 11 11 11 12 12 13 13 14 15 15 15
regularAppStart Baseline
Mean: 0.016 ms
Stdev: 0.001 ms (5.5%)
Runs: 0.014037999790161848 0.014525999780744314 0.014688999857753515 0.014851999934762716 0.014851999934762716 0.015176999848335981 0.015176999848335981 0.015177000313997269 0.015177999623119831 0.015217999927699566 0.015381000004708767 0.015461999922990799 0.015543000306934118 0.015583999920636415 0.015787999611347914 0.015828999690711498 0.015868999995291233 0.015992000233381987 0.016234999988228083 0.016276000067591667 0.0165200000628829 0.016601999755948782 0.01660200022161007 0.016643000300973654 0.016724000219255686 0.016724000219255686 0.016927000135183334 0.017130000051110983 0.0172520000487566 0.017455999739468098

Current
Mean: 0.015 ms
Stdev: 0.001 ms (6.5%)
Runs: 0.013549999799579382 0.013875999953597784 0.013915999792516232 0.014078999869525433 0.01411899970844388 0.014119999948889017 0.014159999787807465 0.014322999864816666 0.0143630001693964 0.014485999941825867 0.014525999780744314 0.014649000018835068 0.014812000095844269 0.014812000095844269 0.014851999934762716 0.014892000239342451 0.014932999853044748 0.015298999845981598 0.015381000004708767 0.015461999922990799 0.015503000002354383 0.015665000304579735 0.015746999997645617 0.0157880000770092 0.015909000299870968 0.016114000231027603 0.016234999988228083 0.016276000067591667 0.016315999906510115 0.016439000144600868 0.016600999981164932 0.017943999730050564

yuwenmemon added a commit that referenced this pull request Dec 19, 2022
@OSBotify
Copy link
Contributor

🚀 Cherry-picked to staging by @stitesExpensify in version: 1.2.41-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @yuwenmemon in version: 1.2.41-4 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 1.3.28-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/AndrewGable in version: 1.3.28-5 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants